package com.chenglu.android.mine.collect.adapter;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chenglu.android.R;
import com.chenglu.android.common.utils.Utils;
import com.chenglu.android.mine.bean.CollectBean;


import java.util.List;

/**
 * @author: lyj
 * @Created: by Copyright 2023 3 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 * @Description：猜你喜欢
 */
public class CouponListAdapter extends BaseQuickAdapter<CollectBean.Data.Records.CouponList, BaseViewHolder> {

    Context mContext;

    public CouponListAdapter(Context context, @Nullable List<CollectBean.Data.Records.CouponList> data) {
        super(R.layout.item_coupon_list, data);
        this.mContext = context;
    }


    @Override
    protected void convert(@NonNull BaseViewHolder helper, CollectBean.Data.Records.CouponList item) {
        if(item.getCouponType()==1){
            helper.setText(R.id.tv_coupon_name,"满"+ Utils.formatZeroNumber(item.getCouponAmount())+"元减"
                    +Utils.formatZeroNumber(item.getMinMoney())+"卷");
        }else if(item.getCouponType() ==2 ) {
            helper.setText(R.id.tv_coupon_name,"折扣"+ Utils.formatZeroNumber(item.getCouponPercentage())+"%");
        }

    }

}
